package pl.streamsoft.currencyApp.model;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class DataBaseConector {

	private static SessionFactory sessionFactory;
	
	static{
		sessionFactory = new Configuration().configure().buildSessionFactory();
	}
	
	private DataBaseConector(){}
	
	public static SessionFactory getInstanceOfSesionFactory(){
		return sessionFactory;
	}

	public static Session getInstanceOfSession() {
		return sessionFactory.openSession();
	}
	
	public static void reset(){
		sessionFactory = new Configuration().configure().buildSessionFactory();
	}
}
